//
//  S5F11Number.m
//  PlayBall
//
//  Created by Huawen Liu on 12-6-14.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddS5F11Number.h"


@implementation JddS5F11Number

@synthesize BallArray;
@synthesize SecondBallArray;
@synthesize ThirdBallArray;


- (id)init{
    self = [super init];
    
    if (self) {
        self.BallArray = [NSMutableArray array];
        self.SecondBallArray = [NSMutableArray array];
        self.ThirdBallArray = [NSMutableArray array];
    }
    
    return self;
}

- (NSInteger)addBallNumber:(NSInteger)number{
    [BallArray addObject:[NSNumber numberWithInt:number]];
    
    return [BallArray count];
}

- (NSInteger)removeBallNumber:(NSInteger)number{
    for (NSNumber *inNumber in BallArray) {
        if ([inNumber intValue] == number) {
            [BallArray removeObject:inNumber];
            break;
        }
    }
    
    return [BallArray count];
}

- (NSInteger)add2BallNumber:(NSInteger)number{
    [SecondBallArray addObject:[NSNumber numberWithInt:number]];
    
    return [SecondBallArray count];
}

- (NSInteger)remove2BallNumber:(NSInteger)number{
    for (NSNumber *inNumber in SecondBallArray) {
        if ([inNumber intValue] == number) {
            [SecondBallArray removeObject:inNumber];
            break;
        }
    }
    
    return [SecondBallArray count];
}
- (NSInteger)add3BallNumber:(NSInteger)number{
    [ThirdBallArray addObject:[NSNumber numberWithInt:number]];
    
    return [ThirdBallArray count];
}

- (NSInteger)remove3BallNumber:(NSInteger)number{
    for (NSNumber *inNumber in ThirdBallArray) {
        if ([inNumber intValue] == number) {
            [ThirdBallArray removeObject:inNumber];
            break;
        }
    }
    
    return [ThirdBallArray count];
}


- (void)clear{
    [BallArray removeAllObjects];
    [SecondBallArray removeAllObjects];
    [ThirdBallArray removeAllObjects];
}

- (BOOL)BallHasNumber:(NSInteger)number{
    for (NSNumber *inNumber in BallArray) {
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;	
}

- (BOOL)Ball2HasNumber:(NSInteger)number{
    for (NSNumber *inNumber in SecondBallArray) {
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;	
}
- (BOOL)Ball3HasNumber:(NSInteger)number{
    for (NSNumber *inNumber in ThirdBallArray) {
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;	
}

@end

